//
//  MyVipCell.m
//  Courses
//
//  Created by YiXuePxh on 15/4/9.
//  Copyright (c) 2015年 boyibang. All rights reserved.
//

#import "MyVipCell.h"
#import "UIImageView+WebCache.h"
#import "NSDate+WTF.h"
#import "CourseClass.h"

@implementation MyVipCell
{
    UIImageView* _imageView;
    UILabel* _courseName;
    UILabel* _classWeixin;
    UILabel* _classOpenDate;
    UILabel* _headTeacher;
    
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (!self) {
        return self;
    }
    self.accessoryType = UITableViewCellAccessoryNone;
    self.backgroundColor = nil;
    self.frame = AutoRectMake(0, 0, DEFAULT_WIDTH, 80, WTFAutoLayoutTypePic);
    _imageView = [[UIImageView alloc] initWithFrame:AutoRectMake(10, 10, 80, 60, WTFAutoLayoutTypeRaw)];
    _imageView.contentMode = UIViewContentModeScaleAspectFit;
    _imageView.layer.cornerRadius = 18;
    _imageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_imageView];
    
    _courseName = [[UILabel alloc]initWithFrame:AutoRectMake(100, 10, 200, 15, WTFAutoLayoutTypeText)];
    _courseName.font = [UIFont fontWithName:nil size:FONT_SIZE_TEXT_DEFAULT];
    [self.contentView addSubview:_courseName];
    
    _classOpenDate = [[UILabel alloc]initWithFrame:AutoRectMake(100, 25, 200, 15, WTFAutoLayoutTypeText)];
    _classOpenDate.font = [UIFont fontWithName:nil size:FONT_SIZE_TEXT_DEFAULT];
    [self.contentView addSubview:_classOpenDate];
    
    _headTeacher = [[UILabel alloc]initWithFrame:AutoRectMake(100, 40, 100, 15, WTFAutoLayoutTypeText)];
    _headTeacher.font = [UIFont fontWithName:nil size:FONT_SIZE_TEXT_DEFAULT];
    [self.contentView addSubview:_headTeacher];
    
    _classWeixin = [[UILabel alloc]initWithFrame:AutoRectMake(100, 55, 100, 15, WTFAutoLayoutTypeText)];
    _classWeixin.font = [UIFont fontWithName:nil size:FONT_SIZE_TEXT_DEFAULT];
    [self.contentView addSubview:_classWeixin];
    
    return self;
}

- (void)setCourse:(VipCourseClass* )course{
    _course = course;
    [_imageView sd_setImageWithURL:[NSURL URLWithString:_course.teacherHeadPhotoUrl]];
    _courseName.text = course.courseName;
    _classOpenDate.text = [NSString stringWithFormat:@"开课时间：%@",_course.classOpenDate];
    _headTeacher.text = [NSString stringWithFormat:@"班主任：%@",_course.headTeacher];
    _classWeixin.text = [NSString stringWithFormat:@"微信号：%@",_course.classWeixinName];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
